﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using TabbedTemplate.Util;
using Xamarin.Forms;

namespace TabbedTemplate.Converters
{
    /// <summary>
    /// 反向布尔转换器。
    /// </summary>
    public class NegativeBoolConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter,
            CultureInfo culture)
        {
            if (value is bool b)
            {
                return !b;
            }

            return null;
        }

        public object ConvertBack(object value, Type targetType,
            object parameter, CultureInfo culture)
        {
            throw new DoNotCallThisException();
        }
    }
}
